package com.neiquan.secondhand.service.impl;

import com.neiquan.backstage.core.bsc.impl.BasePersistentServiceImpl;
import com.neiquan.secondhand.po.Goods;
import com.neiquan.secondhand.service.GoodService;
import com.neiquan.secondhand.util.Entity;

import java.util.Date;

import org.springframework.stereotype.Service;

/**
 * 商品实现类
 * @author chenjunnan
 *
 */
@Service
public class GoodsServiceImpl  extends BasePersistentServiceImpl implements GoodService{



	@Override
	public String saveGoods(Goods goods) {
		if(null!=goods.getId()&&!goods.getId().equals("")){
			Goods o=get(Goods.class, goods.getId());
			Goods obj=(Goods) Entity.modify(o,goods);
			update(obj);
		}else{
			goods.setCreateTime(new Date().getTime());
			goods.setIfpublish(1);
			create(goods);
		}
		return "success";
	}

}
